<template>
  <starFieldEditor :ref="ref" :data="data" :attrs="attrs"></starFieldEditor>
</template>

<script>
export default {
  name: "pg-form",
  components: {},
  inject: ["anc"],
  data() {
    return {
      ref: "createEditor",
      onlyRead: false,
      loading: false,
    };
  },
  props: {
    data: {
      default: () => {
        return {};
      },
    },
    attrs: {
      type: Object,
      default: () => {
        return {};
      },
    },
  },
  watch: {},
  computed: {},
  created() {},
  mounted() {
    this.$nextTick(() => {
      this.$set(this.anc.vms, this.ref, this);
    });
  },
  methods: {
    validate(fn) {
      return this.$refs[this.ref].validate((valid) => {
        if(fn) {
          return fn(valid)
        }else{
          return valid;
        };
      });
    },
    resetFields() {
      return this.$refs[this.ref].resetFields();
    }
  },
};
</script>
<style scoped></style>
